import 'package:intl/intl.dart';

class DateFormatUtil {
  static String? formatPattern;

  static String dateFormat(DateTime date, [String? pattern, String? locale]) {
    var newPattern = pattern ?? formatPattern ?? '';
    // newPattern =
    //     DateFormat('', locale).add_d().add_MMM().add_Hm().pattern ?? '';
    newPattern = 'M' + "-" + "d" + " " + "HH" + ":" + "mm";
    // if (newPattern.isEmpty) {
    //   newPattern =
    //       DateFormat('', locale).add_d().add_MMM().add_Hm().pattern ?? '';
    //
    // }
    var formatDate = DateFormat(newPattern).format(date);
    return formatDate;
  }
}
